cmake_minimum_required(VERSION 3.14)

project(QQ-emoji-analyzer LANGUAGES CXX VERSION 1.0.0)

include(cmake/SparkWithGit.cmake)
spark_initialize_modules()

if(CMAKE_BUILD_TYPE MATCHES "Release")
    # 控制 qDebug 行为
    add_compile_definitions(QT_NO_WARNING_OUTPUT=1 QT_NO_DEBUG_OUTPUT=1)
else()
    add_compile_definitions(
        EXAMPLE_DATA_DIRECTORY="${CMAKE_SOURCE_DIR}/examples/data/")
endif(CMAKE_BUILD_TYPE MATCHES "Release")


# 资源文件路径
set(QRC_SOURCES "")

spark_add_library_path(emoji
    src/gui
)
target_link_qt5(emoji)

spark_add_executable_path(${PROJECT_NAME} 
    src
    ${QRC_SOURCES}
)
target_link_qt5(${PROJECT_NAME})

spark_framework_include_with_git(${PROJECT_NAME} 
    https://gitee.com/spark-framework-libs/spark-framework-features
    FEATURES version screenutil dbusutil)

# 示例集合
option(ENABLE_BUILD_EXAMPLES "Enable Build Examples." OFF)
if(ENABLE_BUILD_EXAMPLES)
    include(examples/dev.cmake)
endif(ENABLE_BUILD_EXAMPLES)

# 测试集合
option(ENABLE_BUILD_TESTS "Enable Build Tests." OFF)
if(ENABLE_BUILD_TESTS)
    add_subdirectory(tests)
endif(ENABLE_BUILD_TESTS)

# 内容默认应用名称: Name= 应与项目名称相同
spark_desktop_macros(
    # 应用名称: Name=
    "QQ Emoji Analyzer"
    # 应用名称: Name[zh_CN]=
    "QQ 表情图分析工具"
    # 应用说明: Comment=
    ""
    # 应用类型: Type=
    "Application"
    # 执行程序: Exec=
    "QQ-emoji-analyzer"
    # 图标路径: Icon=
    "QQ-emoji-analyzer"
    # 应用分类: Categories=
    "Utilitis"
    # MIME类型: MimeType=
    ""
)

#/ 安装主程序
install(TARGETS ${PROJECT_NAME}
    DESTINATION /usr/bin
)

#/ 安装桌面文件
install(FILES ${SPARK_DESKTOP_FILE}
    DESTINATION /usr/share/applications
    RENAME ${PROJECT_NAME}.desktop
)

#/ 安装图标
install(FILES assets/icon.png
    DESTINATION /usr/share/icons/hicolor/512x512/apps
    RENAME ${PROJECT_NAME}.png
)

add_package_descript(cmake/spark-deb-package.descript)
